<?php
define('_file_','edit_cat');
if ( !isGod() )
	if ( !getRights($mod,'full') )
		if ( !News_getAccessFile(_file_) )
		{
			showMsg('Không có quyền truy cập vào trang này này !','ex','center');
			die();
		}
	
include('vsForm.php');
$cid = getVar('cid',true);
if ( empty($cid) || $cid <= 0 )
	$cid = getVar('txtCID',true,true);
if ( empty($cid) || $cid <= 0 )
	die('Dữ liệu không hợp lệ !');
$sql = "select * from category where cid=$cid";
$rs = $link->execute($sql);
//############## init control ##########################
$txtCID = new vsControl('txtCID','hidden');
$txtCID->ctrlVal = $cid;
$txtCID->notPost = true;
$txtCID->valRequire = false;

$txtCatName = new vsControl('txtCatName','textbox','Tên mục');
$txtCatName->charWidth = 70;
$txtCatName->maxChar = 70;
$txtCatName->ctrlVal = $rs->fields('cname');
$txtCatName->ctrlStyle = 'font-family: Tahoma,verdana,arial; font-size: 11px; background-color: #CBDBEF';

$txtCatDesc = new vsControl('txtCatDesc','textarea','Mô tả');
$txtCatDesc->rows = 5;
$txtCatDesc->cols = 70;
$txtCatDesc->ctrlVal = $rs->fields('cdesc');
$txtCatDesc->ctrlStyle = 'font-family: Tahoma,verdana,arial; font-size: 11px; background-color: #FFFFFF';
$txtCatDesc->valRequire = false;


$btnOK = new vsControl('cmdOK','buttonsubmit','Cập nhật &raquo;');
//################ init form ######################
$frm = new vsForm('frmEditCat','admin.php?mod=' . $mod . '&act=edit_cat');
$frm->title = 'Hiệu chỉnh thông tin';
$frm->titleHeight = 25;
$frm->arrItem = array($txtCatName,$txtCatDesc,$txtCID);
$frm->arrButton = array($btnOK);
//############## params for add action #####################
$frm->gcn = &$link;
$frm->tblName = 'category';
$frm->arrFields = array('cname','cdesc');
$frm->arrKeyEdit = array('cid,number'=>$cid);
$frm->actionPrevRender('edit','admin.php?mod=' . $mod);
//##########################################
$frm->frmRender();
?>